<?php


$microurl = mysql_real_escape_string($_GET['microurl']);

$req = mysql_query("SELECT origin, COUNT(origin) as nb FROM url WHERE microurl='".$microurl."'");
$rep = mysql_fetch_array($req);

if($rep['nb']==1){

    mysql_query("UPDATE url SET clic=clic+1 WHERE microurl='".$microurl."'");
    header("Location: ".$rep['origin']);
    exit;
    
}else{

    echo "Erreur 404";

}

?>
